package com.ruoyi.system.service.impl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysAHouseListMapper;
import com.ruoyi.system.domain.SysAHouseList;
import com.ruoyi.system.service.ISysAHouseListService;
import com.ruoyi.common.core.text.Convert;

/**
 * 房屋列表Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-09
 */
@Service
public class SysAHouseListServiceImpl implements ISysAHouseListService 
{
    @Autowired
    private SysAHouseListMapper sysAHouseListMapper;

    /**
     * 查询房屋列表
     * 
     * @param houseId 房屋列表主键
     * @return 房屋列表
     */
    @Override
    public SysAHouseList selectSysAHouseListByHouseId(String houseId)
    {
        return sysAHouseListMapper.selectSysAHouseListByHouseId(houseId);
    }

    /**
     * 查询房屋列表列表
     * 
     * @param sysAHouseList 房屋列表
     * @return 房屋列表
     */
    @Override
    public List<SysAHouseList> selectSysAHouseListList(SysAHouseList sysAHouseList)
    {
        return sysAHouseListMapper.selectSysAHouseListList(sysAHouseList);
    }

    /**
     * 新增房屋列表
     * 
     * @param sysAHouseList 房屋列表
     * @return 结果
     */
    @Override
    public int insertSysAHouseList(SysAHouseList sysAHouseList)
    {
        if (sysAHouseList.getHouseId()==null || "".equals(sysAHouseList.getHouseId())) {
            String s = UUID.randomUUID().toString();
            String id = s.substring(s.length()-5,s.length()-1);
            sysAHouseList.setHouseId(id);

        }
        return sysAHouseListMapper.insertSysAHouseList(sysAHouseList);
    }

    /**
     * 修改房屋列表
     * 
     * @param sysAHouseList 房屋列表
     * @return 结果
     */
    @Override
    public int updateSysAHouseList(SysAHouseList sysAHouseList)
    {
        return sysAHouseListMapper.updateSysAHouseList(sysAHouseList);
    }

    /**
     * 批量删除房屋列表
     * 
     * @param houseIds 需要删除的房屋列表主键
     * @return 结果
     */
    @Override
    public int deleteSysAHouseListByHouseIds(String houseIds)
    {
        return sysAHouseListMapper.deleteSysAHouseListByHouseIds(Convert.toStrArray(houseIds));
    }

    /**
     * 删除房屋列表信息
     * 
     * @param houseId 房屋列表主键
     * @return 结果
     */
    @Override
    public int deleteSysAHouseListByHouseId(String houseId)
    {
        return sysAHouseListMapper.deleteSysAHouseListByHouseId(houseId);
    }
}
